package cn.wolfcode.p2p.base.controller;

import cn.wolfcode.p2p.anno.NeedLogin;
import cn.wolfcode.p2p.base.domain.LoginInfo;
import cn.wolfcode.p2p.base.query.IpLogQueryObject;
import cn.wolfcode.p2p.base.service.IIpLogService;
import cn.wolfcode.p2p.util.UserContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 前台登陆记录
 */
@Controller
public class IpLogController {

    @Autowired
    private IIpLogService ipLogService;

    @RequestMapping("/ipLog")
    @NeedLogin
    public String list(@ModelAttribute("qo")IpLogQueryObject qo, Model m){
        qo.setUsername(UserContext.getLoginInfo().getUsername());
        qo.setUserType(LoginInfo.TYPE_WEBSITE);
        m.addAttribute("pageResult",ipLogService.query(qo));
        return "/iplog_list";
    }

}
